/*
 * @Descripttion: 
 * @Author: yubo
 * @Date: 2022-11-01 17:10:19
 * @LastEditTime: 2022-11-01 17:15:32
 */
fn reset(arr: &mut[u32]) {
    arr[0] = 5;
    arr[1] = 4;
    arr[2] = 3;
    arr[3] = 2;
    arr[4] = 1;
    //重置以后，原始数组为[5,4,3,2,1]
    println!("array length {:?}", arr.len());
    println!("reset array {:?}", arr);
}

fn main() {
    let mut arr = [1,2,3,4,5];
    println!("reset before: origin array {:?}", arr);

    {
        let mut_arr: &mut[u32] = &mut arr;
        reset(mut_arr);
    }
    println!("reset after: origin array {:?}", arr);

    //空间占用
    assert_eq!(std::mem::size_of::<&[u32;5]>(), 8);
    assert_eq!(std::mem::size_of::<&[u32]>(), 16);
    assert_eq!(std::mem::size_of::<&mut[u32]>(), 16);
}